﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AccessGrant.GrantFrameworks;
using FAQFrameworks;
using FooFun.DataElements.Dtos;
using DTOFrameworks;

public partial class Admin_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        PermissionQuery query = PermissionQuery.Create();
        RoleSetQuery roleSetQuery = RoleSetQuery.Create();

        IDataElement de = roleSetQuery.GetRoleOfUserInForum(
            FAQContext.Current.User.AccountId,
            FAQContext.Current.ForumId);

        if (!de["RoleId"].IsEmpty)
        {
            IEnumItem role
                = query.GetAccountById((Guid)de["RoleId"].Value);

            if (role.Name == "版主" || role.Name == "系统管理员")
            {
                Page.DataBind();
                return;
            }
        }

        Response.Redirect("~/Default.aspx");
    }
}
